#include <iostream>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <strings.h>
#include <unistd.h>

int main()
{
    int sockfd = socket(AF_INET, SOCK_STREAM, 0);
    struct sockaddr_in client;
    bzero(&client, sizeof client);
    client.sin_family = AF_INET;
    client.sin_addr.s_addr = inet_addr("127.0.0.1");
    client.sin_port = htons(8080);

    int n = connect(sockfd, (struct sockaddr*)&client, sizeof client);
    if (n < 0) return 1;

    printf("connect success\n");
    while (1)
    {}

    // close(sockfd);
    return 0;
}